/*
*  This file is part of mangusta
*
*  mangusta is free software; you can redistribute it and/or modify
*  it under the terms of the GNU General Public License as published by
*  the Free Software Foundation; either version 2 of the License, or
*  (at your option) any later version.
*
*  mangusta is distributed in the hope that it will be useful,
*  but WITHOUT ANY WARRANTY; without even the implied warranty of
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
*  GNU General Public License for more details.
*
*  You should have received a copy of the GNU General Public License
*  along with mangusta; if not, write to the Free Software
*  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  US
*
*  Author: <antonino.calderone@ericsson.com>, <acaldmail@gmail.com>
*
*/


/* -------------------------------------------------------------------------- */

#ifndef __NU_LANG_DEFS_H__
#define __NU_LANG_DEFS_H__


/* -------------------------------------------------------------------------- */

// Scanner config. data
#define PROGLANG_BLANKS          " \t\r"
#define PROGLANG_NEWLINES        "\n"
#define PROGLANG_SINGLE_CHAR_OPS "!+-*/^,\\=\";:<>?&|"
#define PROGLANG_SINGLE_CHAR_IDS "{}"


#define PROGLANG_OP_MOD          "%"
#define PROGLANG_OP_BSHL         "<<"
#define PROGLANG_OP_BSHR         ">>"
#define PROGLANG_OP_EQUALS       "=="
#define PROGLANG_OP_NOTEQUALS    "!="
#define PROGLANG_OP_LTEQ         "<="
#define PROGLANG_OP_GTEQ         ">="
#define PROGLANG_OP_LT           "<"
#define PROGLANG_OP_GT           ">"
#define PROGLANG_OP_PLUS         "+"
#define PROGLANG_OP_MINUS        "-"
#define PROGLANG_OP_MUL          "*"
#define PROGLANG_OP_DIV          "/"
#define PROGLANG_OP_AND          "&&"
#define PROGLANG_OP_OR           "||"
#define PROGLANG_OP_BXOR         "^"
#define PROGLANG_OP_POWER        "**"

#define PROGLANG_OP_INC          "++"
#define PROGLANG_OP_DEC          "--"

#define PROGLANG_OP_ASSIGN       "="

#define PROGLANG_STMT_FUNCTION   "function"
#define PROGLANG_STMT_CLASS      "class"

#define PROGLANG_WORD_OPS        { PROGLANG_OP_BSHR, \
                                   PROGLANG_OP_BSHL, \
                                   PROGLANG_OP_POWER, \
                                   PROGLANG_OP_AND, \
                                   PROGLANG_OP_OR, \
                                   PROGLANG_OP_EQUALS, \
                                   PROGLANG_OP_NOTEQUALS, \
                                   PROGLANG_OP_LTEQ, \
                                   PROGLANG_OP_GTEQ, \
                                   PROGLANG_OP_INC, \
                                   PROGLANG_OP_DEC \
                                 }

#define PROGLANG_OP_BOR          "|"
#define PROGLANG_OP_BAND         "&"

#define PROGLANG_BEGIN_SUBEXPR   '('
#define PROGLANG_END_SUBEXPR     ')'
#define PROGLANG_BEGIN_STRING    "\""
#define PROGLANG_END_STRING      "\""
#define PROGLANG_ESCAPE_CHAR     '\\'
#define PROGLANG_BEGIN_SUBSCR    '['
#define PROGLANG_END_SUBSCR      ']'

#define PROGLANG_EXPONENT_SYMB    'E'

#define PROGLANG_HEX_PREFIX_SYMB1 '0'
#define PROGLANG_HEX_PREFIX_SYMB2 'X'

#define PROGLANG_BEGIN_SUBEXPR_OP "("
#define PROGLANG_END_SUBEXPR_OP   ")"
#define PROGLANG_BEGIN_SUBSCR_OP  "["
#define PROGLANG_END_SUBSCR_OP    "]"

#define PROGLANG_STMNT_SEP      ";"
#define PROGLANG_LBL_SEP        ":"
#define PROGLANG_PARAM_SEP      ","

#define PROGLANG_LINE_COMMENT   "//"

#define PROGLANG_MAIN_FUNCTION          "main"
#define PROGLANG_MAIN_FUNCTION_RET_TYPE "int"

#define PROGLANG_STMT_ARRAY     "array"
#define PROGLANG_STMT_GOTO      "goto"
#define PROGLANG_STMT_WHILE     "while"
#define PROGLANG_STMT_DO        "do"
#define PROGLANG_STMT_IF        "if"
#define PROGLANG_STMT_ELIF      "elif"
#define PROGLANG_STMT_ELSE      "else"
#define PROGLANG_STMT_FOR       "for"
#define PROGLANG_STMT_BREAK     "break"
#define PROGLANG_STMT_END       "end"

#define PROGLANG_STMT_COUT      "cout"
#define PROGLANG_COUT_OP        "<<"

#define PROGLANG_REFERENCE_OP   "&"
#define PROGLANG_BEGIN_BLOCK_OP "{"
#define PROGLANG_END_BLOCK_OP   "}"

#define PROGLANG_BOOL_TRUE       "true"
#define PROGLANG_BOOL_FALSE      "false"

#define PROGLANG_TYPE_BYTE       "byte"
#define PROGLANG_TYPE_FLOAT      "float"
#define PROGLANG_TYPE_DOUBLE     "double"
#define PROGLANG_TYPE_INTEGER    "int"
#define PROGLANG_TYPE_STRING     "string"
#define PROGLANG_TYPE_BOOLEAN    "bool"
#define PROGLANG_TYPE_UNDEFINED  "undefined"
#define PROGLANG_CONST           "const"


#define PROGLANG_RESERVED_WORDS { \
   PROGLANG_TYPE_BYTE,\
   PROGLANG_TYPE_FLOAT,\
   PROGLANG_TYPE_DOUBLE,\
   PROGLANG_TYPE_INTEGER,\
   PROGLANG_TYPE_BOOLEAN,\
   PROGLANG_TYPE_FLOAT,\
   PROGLANG_BOOL_TRUE,\
   PROGLANG_BOOL_FALSE,\
   PROGLANG_MAIN_FUNCTION,\
   PROGLANG_STMT_CLASS,\
   PROGLANG_STMT_ARRAY,\
   PROGLANG_STMT_GOTO,\
   PROGLANG_STMT_WHILE,\
   PROGLANG_STMT_DO,\
   PROGLANG_STMT_IF,\
   PROGLANG_STMT_ELIF,\
   PROGLANG_STMT_ELSE,\
   PROGLANG_STMT_FOR,\
   PROGLANG_STMT_BREAK,\
   PROGLANG_STMT_END,\
   PROGLANG_STMT_COUT,\
   PROGLANG_STMT_FUNCTION,\
   PROGLANG_CONST,\
}

/* -------------------------------------------------------------------------- */

// Error strings
#define PROGLANG_ERROR_STR__SYNTAXERROR  "Syntax Error"
#define PROGLANG_ERROR_STR__ERRORLOADING "Error loading file or file not found"


/* -------------------------------------------------------------------------- */

// Console prompt
#define PROGLANG_PROMPT_STR     ">"
#define PROGLANG_PROMPT_NEWLINE "\n"


/* -------------------------------------------------------------------------- */

// Xterm config
#define PROGLANG_XTERM_EXECBIN        "xterm"
#define PROGLANG_XTERM_EXECOPT        "-e"
#define PROGLANG_HELP                 "-h"
#define PROGLANG_XTERM_FRAME_SWITCH   "-x"
#define PROGLANG_XTERM_NOFRAME_SWITCH "-nx"


/* -------------------------------------------------------------------------- */

// Command line shortcut

#define PROGLANG_HELP_MACRO 'h' // -h --> HELP "<argument>"
#define PROGLANG_EXEC_MACRO 'e' // -e --> EXEC "<argument>"
#define PROGLANG_LOAD_MACRO 'l' // -l --> LOAD "<argument>"


/* -------------------------------------------------------------------------- */

#endif
